set(CMAKE_BUILD_TYPE Release)
set(CMAKE_CXX_STANDARD 98)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_C_FLAGS_RELEASE "-fdata-sections -ffunction-sections -fstack-protector -O0 -flto")
set(CMAKE_CXX_FLAGS_RELEASE "-fdata-sections -ffunction-sections -fstack-protector -O0 -flto")
add_definitions(-DED25519_CUSTOMHASH -DED25519_CUSTOMRANDOM)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")

#build openssl first
#add_subdirectory(openssl)

# Java JNI
include_directories(jni libsodium/include)

# source files
set(SOURCE_FILES com_smartx_crypto_Native.cpp ripemd160.c ed25519-donna/ed25519.c)

add_library(smartxcrypto SHARED ${SOURCE_FILES})

#目前暂时这么做，后面要编译libsodium
#TODO:根据andriod的cpu架构调用不同的libsodium的编译脚本
target_link_libraries(
        smartxcrypto
        "-L../../../../libs/armeabi-v7a -lsodium"
)
